package handler

import (
	"apibe/single/src/v1/plugin/tourist"
	"database/sql"
	"go.mongodb.org/mongo-driver/mongo"
)

func MongoQueryOneHandler(one *tourist.QueryOne) (*map[string]interface{}, error) {
	return tourist.ApiMongo.QueryOne(one)
}

func MongoQueryManyHandler(many *tourist.QueryMany) (*map[string]interface{}, error) {
	return tourist.ApiMongo.QueryMany(many)
}

func MongoUpdateOneHandler(one *tourist.UpdateOne) (*mongo.UpdateResult, error) {
	return tourist.ApiMongo.UpdateOne(one)
}

func MongoUpdateManyHandler(many *tourist.UpdateMany) (*mongo.UpdateResult, error) {
	return tourist.ApiMongo.UpdateMany(many)
}

func MongoCreateOneHandler(one *tourist.InsertOne) (*mongo.InsertOneResult, error) {
	return tourist.ApiMongo.CreateOne(one)
}

func MongoCreateManyHandler(many *tourist.InsertMany) (*mongo.InsertManyResult, error) {
	return tourist.ApiMongo.CreateMany(many)
}

func MongoRemoveOneHandler(one *tourist.RemoveOne) (*mongo.DeleteResult, error) {
	return tourist.ApiMongo.RemoveOne(one)
}

func MongoRemoveManyHandler(many *tourist.RemoveMany) (*mongo.DeleteResult, error) {
	return tourist.ApiMongo.RemoveMany(many)
}

func RedisSetOneHandler(one *tourist.SetOne) error {
	return tourist.ApiRedis.SetOne(one)
}

func RedisSetManyHandler(many *tourist.SetMany) *[]string {
	return tourist.ApiRedis.SetMany(many)
}

func RedisGetOneHandler(one *tourist.GetOne) ([]byte, error) {
	return tourist.ApiRedis.GetOne(one)
}

func RedisGetManyHandler(many *tourist.GetMany) (*[]interface{}, error) {
	return tourist.ApiRedis.GetMany(many)
}

func RedisDelOneHandler(one *tourist.DelOne) (int64, error) {
	return tourist.ApiRedis.DelOne(one)
}

func RedisDelManyHandler(many *tourist.DelMany) (int64, error) {
	return tourist.ApiRedis.DelMany(many)
}

func MysqlSelectOne(one *tourist.SelectOne) (*map[string]interface{}, error) {
	return tourist.ApiMysql.SelectOne(one)
}

func MysqlSelectMany(many *tourist.SelectMany) (*[]map[string]interface{}, error) {
	return tourist.ApiMysql.SelectMany(many)
}

func MysqlExecOne(one *tourist.ExecOne) (*sql.Result, error) {
	return tourist.ApiMysql.ExecOne(one)
}

func MysqlExecMany(many *tourist.ExecMany) (*[]sql.Result, error) {
	return tourist.ApiMysql.ExecMany(many)
}
